import requestProxy from '@/utils/request';
const { request } = requestProxy;

// 获取成本列表
export function getCostList(data) {
  return request({
    url: 'admin/cost/list',
    method: 'post',
    data
  });
}
// 获取成本结算状态
export function getCostSettlementStatus(params) {
  return request({
    url: 'admin/cost/settlement/status',
    method: 'get',
    params
  });
}

// 新建成本
export function createCost(data) {
  return request({
    url: 'admin/cost/create',
    method: 'post',
    data
  });
}

// 编辑成本
export function editCost(data) {
  return request({
    url: 'admin/cost/edit',
    method: 'put',
    data
  });
}

// 删除成本
export function deleteCost(params) {
  if (params.id) { // 2.9.6修改id为ids,类型为字符串
    params.ids = `${params.id}`;
  }
  delete params.id;
  return request({
    url: 'admin/cost/delete',
    method: 'delete',
    params
  });
}

// 批量恢复/忽略成本
export function costBatchStatus(data) {
  return request({
    url: 'admin/cost/batchStatus',
    method: 'put',
    data
  });
}

// 获取成本详情
export function getCostDetail(params) {
  return request({
    url: 'admin/cost/detail',
    method: 'get',
    params
  });
}

// 关联订单
export function relatedOrder(data) {
  return request({
    url: 'admin/cost/relatedOrder',
    method: 'put',
    data
  });
}

// 取消关联
export function cancelRelated(id) {
  return request({
    url: 'admin/cost/related/cancel/' + id,
    method: 'post'
  });
}

// 审批成本
export function costApproval(data) {
  return request({
    url: 'admin/cost/approval',
    method: 'put',
    data
  });
}

// 获取成本统计
export function getCostStatistics(params) {
  return request({
    url: 'admin/cost/list/statistics',
    method: 'get',
    params
  });
}

// 审批人变更交接列表
export function queryCostHandoverList(params) {
  return request({
    url: '/admin/cost/handover/list',
    method: 'get',
    params
  });
}

// 审批审批转交交接项列表
export function getCostHandoverInfoList(params) {
  return request({
    url: '/admin/cost/handoverInfo/list',
    method: 'get',
    params
  });
}

// 审批审批转交提交
export function costHandoverModify(data) {
  return request({
    url: '/admin/cost/handover/modify',
    method: 'post',
    data
  });
}
